
from django.urls import re_path
from rest_framework_jwt.views import obtain_jwt_token
from meiduo_admin.views.home_views import *
from meiduo_admin.views.user_views import *
from meiduo_admin.views.sku_views import *
from meiduo_admin.views.spu_views import *
from meiduo_admin.views.spec_views import *
from meiduo_admin.views.option_views import *
from meiduo_admin.views.image_views import *
from meiduo_admin.views.order_views import *
from meiduo_admin.views.perm_views import *
from meiduo_admin.views.group_views import *
from meiduo_admin.views.admin_views import *

from meiduo_admin.views.GoodsChannel_views import *
from meiduo_admin.views.goods_views import *



urlpatterns = [
    re_path(r'^authorizations/$', obtain_jwt_token),

    #用户总数统计
    re_path(r'^statistical/total_count/$', UserTotalCountView.as_view()),

    #当日新增用户
    re_path(r'^statistical/day_increment/$', UserDayCountView.as_view()),

    #日活跃用户
    re_path(r'^statistical/day_active/$', UserActiveCountView.as_view()),

    #日下单用户
    re_path(r'^statistical/day_orders/$', UserOrderCountView.as_view()),

    #月增用户
    re_path(r'^statistical/month_increment/$', UserMonthCountView.as_view()),

    #日分类商品访问
    re_path(r'^statistical/goods_day_views/$', GoodsDayView.as_view()),

    #用户列表数据
    re_path(r'^users/$', UserView.as_view()),

    #SKU管理
    re_path(r'^skus/$', SKUGoodsView.as_view(actions={
        'get': 'list',
        'post':'create'
    })),
    re_path(r'^skus/(?P<pk>\d+)/$', SKUGoodsView.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),

    #新建sku可选三级分类
    re_path(r'^skus/categories/$', SKUCategorieView.as_view()),

    #新建sku可选spu信息
    re_path(r'^goods/simple/$', SPUSimpleView.as_view()),

    #新建sku选中的spu可选的规格和选项信息
    re_path(r'^goods/(?P<pk>\d+)/specs/$', SPUSpecView.as_view()),

    #SPU管理
    re_path(r'^goods/$', SPUGoodsView.as_view(actions={
        'get':'list',
        'post': 'create'
    })),
    re_path(r'^goods/(?P<pk>\d+)/$', SPUGoodsView.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),


    #新建SPU可选品牌
    re_path(r'^goods/brands/simple/$',SPUBrandView.as_view()),

    # 新建SPU可选一级分类
    re_path(r'^goods/channel/categories/$', SPUCateView.as_view()),
    # 新建SPU可选二级或三级分类
    re_path(r'^goods/channel/categories/(?P<pk>\d+)/$', SPUCateView.as_view()),



    #规格表增删改查
    re_path(r'^goods/specs/$', SpecViewSet.as_view(actions={
        'get': 'list',
        'post': 'create'
    })),
    re_path(r'^goods/specs/(?P<pk>\d+)/$',SpecViewSet.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),

    #新建选项可选规格
    re_path(r'^goods/specs/simple/$', SpecSimpleListView.as_view()),

    #选项表增删改查
    # 选项表管理
    re_path(r'^specs/options/$', OptViewSet.as_view(actions={
        'get': 'list',
        'post': 'create'
    })),
    re_path(r'^specs/options/(?P<pk>\d+)/$', OptViewSet.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),

    #图片管理
    re_path(r'^skus/images/$',ImageViewSet.as_view(actions={
        'get': 'list',
        'post': 'create'
    })),
    re_path(r'^skus/images/(?P<pk>\d+)/$', ImageViewSet.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),

    #新增图片可选sku
    re_path(r'^skus/simple/$', SKUSimpleListView.as_view()),


    #订单管理
    re_path(r'^orders/$', OrderView.as_view(actions={'get':'list'})),
    re_path(r'^orders/(?P<pk>\d+)/$', OrderView.as_view(actions={'get': 'retrieve'})),
    re_path(r'^orders/(?P<pk>\d+)/status/$', OrderView.as_view(actions={'patch': 'partial_update'})),

    #权限管理
    re_path(r'^permission/perms/$',PermView.as_view(actions={
        'get': 'list',
        'post': 'create'
    })),
    re_path(r'^permission/perms/(?P<pk>\d+)/$', PermView.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),

    #新增权限可选类型
    re_path(r'^permission/content_types/$', PermContentTypeView.as_view()),

    #分组管理
    re_path(r'^permission/groups/$', GroupView.as_view(actions={
        'get': 'list',
        'post': 'create'
    })),
    re_path(r'^permission/groups/(?P<pk>\d+)/$', GroupView.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),

    #新增分组可选权限
    re_path(r'^permission/simple/$', GroupPermView.as_view()),

    re_path(r'^permission/admins/$', AdminUserView.as_view(actions={
        'get': 'list',
        'post': 'create'
    })),
    re_path(r'^permission/admins/(?P<pk>\d+)/$', AdminUserView.as_view(actions={
        'get':'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),
    re_path(r'^permission/groups/simple/$', AdminGroupView.as_view()),



    #频道管理
    re_path(r'^goods/channels/$', GoodsChannelView.as_view(actions={
        'get': 'list',
        'post': 'create'
    })),
    re_path(r'^goods/channels/(?P<pk>\d+)/$', GoodsChannelView.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),

    re_path(r'^goods/channel_types/$', GoodsChannelGroupView.as_view()),

    re_path(r'^goods/categories/$', GoodsChannelCategoriesView.as_view()),



    #品牌管理
    re_path(r'^goods/brands/$', GoodsBrandsView.as_view(actions={
        'get': 'list',
        'post': 'create'
    })),
    re_path(r'^goods/brands/(?P<pk>\d+)/$', GoodsBrandsView.as_view(actions={
        'get': 'retrieve',
        'put': 'update',
        'delete': 'destroy'
    })),

]